<script setup>
import { getIsIos } from "@/utils/host";
import { ref } from "vue";
import projectConfig from "@/config/project/index.js";

defineProps({ expireVipModal: Boolean });

const emit = defineEmits("update:expireVipModal");

let isIos = ref(false);

getIsIos({
  fn: (res) => {
    isIos.value = res;
  },
});

const toPage = () => {
  uni.navigateTo({
    url: "/user-center/vip/index",
  });
};
</script>

<template>
  <div class="expire-vip-modal-box">
    <van-popup round :show="expireVipModal" @close="emit('update:expireVipModal', false)" :z-index="1500">
      <div class="expire-vip-modal">
        <img class="imgSty" src="@/assets/imgs/pages/vip/toast.png" alt="" />
        <div class="content">
          <p class="title">
            <slot>算力值不足，继续订阅即可继续享用会员权益</slot>
          </p>
          <div class="feature">
            <div class="item">
              <img src="@/assets/imgs/gdgn.png" alt="" />
              <p>更多功能</p>
            </div>
            <div class="item">
              <img src="@/assets/imgs/AIlt.png" alt="" />
              <p>AI聊天</p>
            </div>
            <div class="item">
              <img src="@/assets/imgs/AIhh.png" alt="" />
              <p>AI绘画</p>
            </div>
          </div>
          <button class="btn" open-type="contact" show-message-card send-message-title="订阅会员"
            :send-message-img="projectConfig.chat.contactImgPath" send-message-path="/pages/painting/index" v-if="isIos">
            点击解决
          </button>
          <button class="btn" v-else @click="toPage">点击解决</button>
        </div>
      </div>
    </van-popup>
  </div>
</template>

<style lang="less" scoped>
.expire-vip-modal-box {
  .expire-vip-modal {
    position: relative;

    .imgSty {
      position: absolute;
      width: 549rpx;
      height: 651rpx;
      border-radius: 25rpx;
    }

    .content {
      box-sizing: border-box;
      position: absolute;
      width: 549rpx;
      height: 651rpx;
      border-radius: 25rpx;
      padding: 200rpx 57rpx 87rpx;

      .title {
        text-align: center;
        font-size: 32rpx;
        color: #ecad65;
        font-weight: bold;
      }

      .feature {
        display: flex;
        align-items: center;
        justify-content: space-around;
        margin: 30rpx 0 50rpx;

        .item {
          width: 88rpx;
          text-align: center;

          image {
            display: block;
            width: 80rpx;
            height: 80rpx;
            margin: 0 auto;
          }

          view {
            font-size: 22rpx;
            color: var(--a-main-color);
          }
        }
      }

      .btn {
        width: 436rpx;
        height: 72rpx;
        line-height: 72rpx;
        background: linear-gradient(243deg, #f3c998 0%, #f8e6d1 100%);
        border-radius: 36rpx;
        text-align: center;
        color: #946828;
        font-size: 30rpx;
        font-weight: bold;
      }
    }
  }
}
</style>
